USE [ServerMonitor]
GO
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_SQLServerLog_LogTime]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[SQLServerLog] DROP CONSTRAINT [DF_SQLServerLog_LogTime]
END
GO
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_SQLServerLog_IsError]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[SQLServerLog] DROP CONSTRAINT [DF_SQLServerLog_IsError]
END
GO
USE [ServerMonitor]
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SQLServerLog]') AND type in (N'U'))
DROP TABLE [dbo].[SQLServerLog]
GO
USE [ServerMonitor]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SQLServerLog](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[LogTime] [datetime] NULL,
	[ProcessInfo] [nvarchar](256) NULL,
	[LogText] [nvarchar](3000) NULL,
	[IsError] [bit] NULL,
 CONSTRAINT [PK_SQLServerLog] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SQLServerLog] ADD  CONSTRAINT [DF_SQLServerLog_LogTime]  DEFAULT (getdate()) FOR [LogTime]
GO
ALTER TABLE [dbo].[SQLServerLog] ADD  CONSTRAINT [DF_SQLServerLog_IsError]  DEFAULT ((0)) FOR [IsError]
GO


